package com.dhcc.bpm.modules.gateway.fileGateway.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.gateway.fileGateway.entity.EftpTransport;
import com.dhcc.bpm.modules.gateway.fileGateway.service.IEftpTransportService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 *  控制器
 *
 * @author lizeyu
 * @since 2022-04-05
 */
@RestController
@AllArgsConstructor
@RequestMapping("bpm-gateway/eftptransport")
@Api(value = "", tags = "接口")
public class EftpTransportController extends BladeController {

	private IEftpTransportService eftpTransportService;

	/**
	 * 详情
	 */
	@GetMapping("/detail")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "详情", notes = "传入eftpTransport")
	public R<EftpTransport> detail(EftpTransport eftpTransport) {
		EftpTransport detail = eftpTransportService.getOne(Condition.getQueryWrapper(eftpTransport));
		return R.data(detail);
	}

	/**
	 * 分页 
	 */
	@GetMapping("/list")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "分页", notes = "传入eftpTransport")
	public R<IPage<EftpTransport>> list(EftpTransport eftpTransport, Query query) {
		IPage<EftpTransport> pages = eftpTransportService.page(Condition.getPage(query), Condition.getQueryWrapper(eftpTransport).orderByDesc("create_time"));
		return R.data(pages);
	}

//	/**
//	 * 自定义分页
//	 */
//	@GetMapping("/page")
//	@ApiOperationSupport(order = 3)
//	@ApiOperation(value = "分页", notes = "传入eftpTransport")
//	public R<IPage<EftpTransportVO>> page(EftpTransportVO eftpTransport, Query query) {
//		IPage<EftpTransportVO> pages = eftpTransportService.selectEftpTransportPage(Condition.getPage(query), eftpTransport);
//		return R.data(pages);
//	}

	/**
	 * 新增 
	 */
	@PostMapping("/save")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "新增", notes = "传入eftpTransport")
	public R save(@Valid @RequestBody EftpTransport eftpTransport) {
		return R.status(eftpTransportService.save(eftpTransport));
	}

	/**
	 * 修改 
	 */
	@PostMapping("/update")
	@ApiOperationSupport(order = 5)
	@ApiOperation(value = "修改", notes = "传入eftpTransport")
	public R update(@Valid @RequestBody EftpTransport eftpTransport) {
		return R.status(eftpTransportService.updateById(eftpTransport));
	}

	/**
	 * 新增或修改 
	 */
	@PostMapping("/submit")
	@ApiOperationSupport(order = 6)
	@ApiOperation(value = "新增或修改", notes = "传入eftpTransport")
	public R submit(@Valid @RequestBody EftpTransport eftpTransport) {
		return R.status(eftpTransportService.saveOrUpdate(eftpTransport));
	}

	
//	/**
//	 * 删除
//	 */
//	@PostMapping("/remove")
//	@ApiOperationSupport(order = 7)
//	@ApiOperation(value = "逻辑删除", notes = "传入ids")
//	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
//		return R.status(eftpTransportService.deleteLogic(Func.toLongList(ids)));
//	}

	
}
